<template>
	<view class="scroll-view-table">
		<view v-show="!dataArr.length?true:false" class="font-red" width="100%" style="text-align: center;">请先选择源单</view>
		<uni-table ref="table" type="" stripe :loading="loading" border emptyText="暂无更多数据">
			<uni-tr v-for="(item, index) in dataArr" :key="index">
				<uni-td align="left" class="scroll-view-table-td">
					<div class="div-border">
						<view class="td-view">
							<span><label>物料：</label>{{ item.inv_name }}</text></span>
						</view>
						<view class="td-view">
							<span><label>编码：</label>{{ item.inv_number }}</span>
							<span style="width: 40%;"><label>单位：</label>{{ item.unit_name==undefined?item.unit:item.unit_name }}</span>
						</view>
						<view class="td-view">
							<span><label>规格：</label>{{ item.inv_specification }}</span>
						</view>
						<view class="td-view">
							<span><label>批号：</label>{{ item.cBatch }}</span>
						</view>
						<view class="td-view">
							<span><label>应出：</label>{{ item.quantity }}</span>
						</view>
					</div>
				</uni-td>
			</uni-tr>
		</uni-table>
	</view>
</template>

<script>
export default {
	props: {
		dataArr: {
			type: Array,
			default: []
		},
	},
	components: {
	},
	data() {
	  return {
		  loading: false,
		  stock_id:uni.getStorageSync('user').stock_id
		}
	},
	mounted(){
		let _this = this
		
		uni.$off("select_stock_id")
		uni.$on("select_stock_id", (select_stock_id) => {
			this.stock_id = select_stock_id
		})
			
		uni.$off("reshowMaterialList")
		uni.$on("reshowMaterialList", (arr) => {
			arr.forEach((item,key)=>{
				this.$set(this.dataArr,key,item)
			})
		})
	},
	destroyed() {
		uni.$off('select_stock_id')
		uni.$off('reshowMaterialList') 
	},
	methods:{
		
	}
}
</script>
<style lang="scss">
.div-border{
	border: 1px solid $sky-border-color;
	box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
	border-radius: 10rpx;
	padding: 5rpx;
	margin-bottom: 30rpx;
}
</style>